package com.limu.boot.controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
public class HelloController {

    /*
    *
    * public String hello(@RequestParam("username") String name){
        return "aaa";
    }
    *  public String hello(HttpSession session){
        return "aaa";
    }
    *
    * public String hello(Model model){
        //request请求域中
        return "aaa";
    }
    * */

    @RequestMapping("/bg.jpg")
    public String hello() {
        //request请求域中
        return "aaa";
    }

    //@RequestMapping(value = "/user",method = RequestMethod.GET)
    @GetMapping("/user")
    public String getUser() {
        return "GET-张三";
    }

    //@RequestMapping(value = "/user",method = RequestMethod.POST)
    @PostMapping("/user")
    public String saveUser() {
        return "POST-张三";
    }


    //@RequestMapping(value = "/user",method = RequestMethod.PUT)
    @PutMapping("/user")
    public String putUser() {
        return "PUT-张三";
    }

    //@RequestMapping(value = "/user",method = RequestMethod.DELETE)
    @DeleteMapping("/user")
    public String deleteUser() {
        return "DELETE-张三";
    }

    //扩展点：如何把_method 这个名字换成我们自己喜欢的
}
